//
// Created by 高森森 on 2022/1/13.
//

#include <algorithm>
#include "Solution4.h"
int Solution4::findContentChildren(vector<int> &g, vector<int> &s) {
    sort(g.begin(),g.end());
    sort(s.begin(),s.end());
    int i=0;
    int j=0;
    int numG=g.size();
    int numS=s.size();
    int cout=0;
    while(i<numG&&j<numS)
    {
        if(g[i]>s[j])
        {
            j++;
        }
        else{
            i++;
            j++;
            cout++;
        }

    }
    return cout;
}
